"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WechatSdkManager = void 0;
const HttpUtil_1 = require("../src/engine/utils/HttpUtil");
const Logger_1 = require("../src/engine/utils/Logger");
// com.game.dajialejingjis"
// const APP_ID: string = "wx9d9b4a34a86f5d2f"
// const AppSecret: string = "368d06d0cc607ac690d2eb1b574ba0f1"
// com.g1ame.dajialejingji
// const APP_ID: string = "wx2b30957daca6d855"
// const AppSecret: string = "5dc1046cb482a7676ce9c6ecc802c364"
let APP_ID = "wx9cef8b1ccbebbfc2";
let AppSecret = "76872e7ea48332b55afe4deca8fa2ba4";
// 闲聚ol
// AppID: wx1a5058ec3509f764
// AppSecret: 5e20144a380ccfce2272046f1d1817f8
class WechatSdkManager {
    init() {
        // if(Config.environment == Config.EnvironmentType.chaoju_new){
        //     APP_ID = "wx556014a7bbe71d79" //潮剧NEW
        //     AppSecret = "e1ac3cf0582f6a1c055502e207866e62"
        // }
        // else if (Config.environment == Config.EnvironmentType.yueyouhui) {
        //     APP_ID = "wx77c21f194f5059c2" //粤友会
        //     AppSecret = "e7d7cd76113943cb16ce1827923a25b2"
        // }else if(Config.environment == Config.EnvironmentType.xj){
        //     APP_ID = "wx3e96c7c8064757ad" //闲聚ol
        //     AppSecret = "24796aa1ed92676d5277278e62a678bc"
        // }
        // else if(Config.environment == Config.EnvironmentType.Jk){
        //     APP_ID = "wx04cbd166f4a53f77" //jk
        //     AppSecret = "7341f896d5a9cb825a404e2a5f5d79fc"
        // }
        // else if(Config.environment == Config.EnvironmentType.chaoyou){
        //     APP_ID = "wx26b9e349e4541f20" //潮友
        //     AppSecret = "13ede4435e4d728fbba1e0e9125e4d4a"
        // }
        // else{
        APP_ID = "wx9cef8b1ccbebbfc2"; //
        AppSecret = "76872e7ea48332b55afe4deca8fa2ba4";
        // }
    }
    get_access_token(code, callback = null) {
        let data = {
            "appid": APP_ID,
            "secret": AppSecret,
            "code": code,
            grant_type: "authorization_code"
        };
        Logger_1.Logger.log("get_access_token", data);
        HttpUtil_1.HttpUtil.request_by_form("https://api.weixin.qq.com/sns/oauth2/access_token", data, callback);
    }
    get_userinfo(access_token, openid, callback = null) {
        let data = {
            access_token: access_token,
            openid: openid
        };
        HttpUtil_1.HttpUtil.request_by_form("https://api.weixin.qq.com/sns/userinfo", data, callback);
    }
}
exports.WechatSdkManager = WechatSdkManager;
WechatSdkManager.instance = new WechatSdkManager();
